package com.wang.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.wang.common.pojo.BasePojo;


public class AResult extends BasePojo<AResult>
{
	private int id;
	/**
	 * 邮件Id
	 */
	private int emailId;
	/**
	 * 收件人地址
	 */
	private String rcpt;
	/**
	 * 发件人地址
	 */
	private String sender;
	private String url ; 
	private String fromname ; 
	/**
	 * 匿名:0:否;1:是
	 */
	private byte anonStatus;
	/**
	 * 白名单:0:否;1:是
	 */
	private byte whiteStatus;
	/**
	 * url:0:否;1:是
	 */
	private byte urlStatus;
	private byte groupStatus ; 
	/**
	 * 级别:三者相加
	 */
	private byte level;
	private byte status ;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	
	
	/* 字符串描述 */
	private String statusStr ;
	/**
	 * 匿名:0:否;1:是
	 */
	private String anonStatusStr ;
	/**
	 * 白名单:0:否;1:是
	 */
	private String whiteStatusStr ;
	/**
	 * url:0:否;1:是
	 */
	private String urlStatusStr ;
	private String groupStatusStr ; 
	
	/*  枚举值 */
	private Map<String,Object> enumsMap = new TreeMap<String, Object>();
	
	/**
	 * 获取一个map;
	 * map有两个要素：键和值,而枚举有三个要素:code,info,枚举项
	 * @return	map的键是:枚举项-code值,值是:info
	 */
	public Map<String, Object> getEnumsMap()
	{
		for(AEmailEnum enumTemp : AEmailEnum.values())
		{
			enumsMap.put(enumTemp.toString() + "-" + enumTemp.getCode(), enumTemp.getInfo());
		}
		return enumsMap;
	}
	
	/**
	 * 根据status的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getStatusStr()
	{
		for(AResultEnum enumTemp : AResultEnum.values())
		{
			if(enumTemp.toString().startsWith("STATUS_")
				&& enumTemp.getCode() == this.getStatus())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return statusStr;
	}
	
	/**
	 * 根据AnonStatus的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getAnonStatusStr()
	{

		for(AResultEnum enumTemp : AResultEnum.values())
		{
			if(enumTemp.toString().startsWith("ANONSTATUS_")
				&& enumTemp.getCode() == this.getAnonStatus())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return anonStatusStr;
	}

	/**
	 * 根据WhiteStatus的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getWhiteStatusStr()
	{
		for(AResultEnum enumTemp : AResultEnum.values())
		{
			if(enumTemp.toString().startsWith("WHITESTATUS_")
				&& enumTemp.getCode() == this.getWhiteStatus())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return whiteStatusStr;
	}

	/**
	 * 根据UrlStatus的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getUrlStatusStr()
	{
		for(AResultEnum enumTemp : AResultEnum.values())
		{
			if(enumTemp.toString().startsWith("URLSTATUS_")
				&& enumTemp.getCode() == this.getUrlStatus())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return urlStatusStr;
	}
	
	/**
	 * 根据UrlStatus的值,和枚举中对应的值,
	 * 返回枚举对应的字符串
	 * @return
	 */
	public String getGroupStatusStr()
	{
		for(AResultEnum enumTemp : AResultEnum.values())
		{
			if(enumTemp.toString().startsWith("GROUPSTATUS_")
				&& enumTemp.getCode() == this.getGroupStatus())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return groupStatusStr;
	}

	public int getId()
	{
		return id;
	}
	public void setId(int id)
	{
		this.id = id;
	}
	public int getEmailId()
	{
		return emailId;
	}
	public void setEmailId(int emailId)
	{
		this.emailId = emailId;
	}
	public String getRcpt()
	{
		return rcpt;
	}
	public void setRcpt(String rcpt)
	{
		this.rcpt = rcpt;
	}
	public String getSender()
	{
		return sender;
	}
	public void setSender(String sender)
	{
		this.sender = sender;
	}
	public byte getAnonStatus()
	{
		return anonStatus;
	}
	public void setAnonStatus(byte anonStatus)
	{
		this.anonStatus = anonStatus;
	}
	public byte getWhiteStatus()
	{
		return whiteStatus;
	}
	public void setWhiteStatus(byte whiteStatus)
	{
		this.whiteStatus = whiteStatus;
	}
	public byte getUrlStatus()
	{
		return urlStatus;
	}
	public void setUrlStatus(byte urlStatus)
	{
		this.urlStatus = urlStatus;
	}
	public byte getLevel()
	{
		return level;
	}
	public void setLevel(byte level)
	{
		this.level = level;
	}
	public byte getStatus()
	{
		return status;
	}
	public void setStatus(byte status)
	{
		this.status = status;
	}
	public Date getCreateTime()
	{
		return createTime;
	}
	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}
	public Date getUpdateTime()
	{
		return updateTime;
	}
	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}
	public Date getPubTime()
	{
		return pubTime;
	}
	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getFromname() {
		return fromname;
	}

	public void setFromname(String fromname) {
		this.fromname = fromname;
	}

	public byte getGroupStatus() {
		return groupStatus;
	}

	public void setGroupStatus(byte groupStatus) {
		this.groupStatus = groupStatus;
	}
	
}
